import request from './request'

// 管理端相关接口
export class useAdminApi {
    // 登录接口
    async login(data: any) {
        console.log("调用登录接口");
        const response: any = await request({
            method: 'post',
            url: '/admin/login',
            data
        })
        return response;
    }

    // 注册接口
    async register(data: any) {
        console.log("调用注册接口");
        const response: any = await request({
            method: 'post',
            url: '/admin/register',
            data
        })
        return response;
    }

    // 获取验证码
    async getVerifiedCode(email: string) {
        console.log("调用验证码发送接口");
        const response = await request({
            method: 'get',
            url: '/admin/register/getVerifiedCode',
            params: {
                email
            }
        });
        return response;
    }

    // 登出接口
    async logout() {
        console.log("调用退出登录接口")
        const response = await request({
            method: 'post',
            url: '/admin/logout',
        })
        return response;
    }
}
